package com.control.qct.businesssteward.adapter;

import android.support.annotation.Nullable;

import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.model.DayStatisticTableModel;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/12/25 0025.
 */

public class DayStatisticTableAdapter extends BaseQuickAdapter<DayStatisticTableModel.SummaryBean, BaseViewHolder> {
    private int max;
    private int id = 1;

    public DayStatisticTableAdapter() {
        super(R.layout.rv_day_statistic_table_item);
    }

    @Override
    protected void convert(BaseViewHolder holder, DayStatisticTableModel.SummaryBean item) {
        holder.setText(R.id.tv_type_name, item.getTitle()).setText(R.id.tv_type_num, id == 1 ? item.getTotal() + "" :
                item.getCount() + "").setProgress(R.id.progress_bar, id == 1 ? item.getTotal() : item.getCount(), max);
    }

    public void setProgressMax(int max, int id) {
        this.max = max;
        this.id = id;
        notifyDataSetChanged();
    }
}
